<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QSignalTransition Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QSignalTransition Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QSignalTransition class provides a transition based on a Qt
signal. <a href="#details">More...</a></p>

<p>Inherits <a href="qabstracttransition.html">QAbstractTransition</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qsignaltransition.html#QSignalTransition">__init__</a></b> (<i>self</i>, QState&#160;<i>sourceState</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qsignaltransition.html#QSignalTransition-2">__init__</a></b> (<i>self</i>, QObject&#160;<i>sender</i>, SIGNAL()&#160;<i>signal</i>, QState&#160;<i>sourceState</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qsignaltransition.html#QSignalTransition-3">__init__</a></b> (<i>self</i>, signal&#160;<i>signal</i>, QState&#160;<i>sourceState</i>&#160;=&#160;None)</li><li><div class="fn" />bool <b><a href="qsignaltransition.html#event">event</a></b> (<i>self</i>, QEvent&#160;<i>e</i>)</li><li><div class="fn" />bool <b><a href="qsignaltransition.html#eventTest">eventTest</a></b> (<i>self</i>, QEvent&#160;<i>event</i>)</li><li><div class="fn" /><b><a href="qsignaltransition.html#onTransition">onTransition</a></b> (<i>self</i>, QEvent&#160;<i>event</i>)</li><li><div class="fn" />QObject <b><a href="qsignaltransition.html#senderObject">senderObject</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsignaltransition.html#setSenderObject">setSenderObject</a></b> (<i>self</i>, QObject&#160;<i>sender</i>)</li><li><div class="fn" /><b><a href="qsignaltransition.html#setSignal">setSignal</a></b> (<i>self</i>, QByteArray&#160;<i>signal</i>)</li><li><div class="fn" />QByteArray <b><a href="qsignaltransition.html#signal">signal</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QSignalTransition class provides a transition based on a Qt
signal.</p>
<p>Typically you would use the overload of <a href="qstate.html#addTransition">QState.addTransition</a>() that takes
a sender and signal as arguments, rather than creating
QSignalTransition objects directly. QSignalTransition is part of
<a href="statemachine-api.html">The State Machine
Framework</a>.</p>
<p>You can subclass QSignalTransition and reimplement <a href="qsignaltransition.html#eventTest">eventTest</a>() to make a signal
transition conditional; the event object passed to <a href="qsignaltransition.html#eventTest">eventTest</a>() will be a
<a href="qstatemachine-signalevent.html">QStateMachine.SignalEvent</a>
object. Example:</p>
<pre class="cpp">
 <span class="keyword">class</span> CheckedTransition : <span class="keyword">public</span> <span class="type">QSignalTransition</span>
 {
 <span class="keyword">public</span>:
     CheckedTransition(<span class="type"><a href="qcheckbox.html">QCheckBox</a></span> <span class="operator">*</span>check)
         : <span class="type">QSignalTransition</span>(check<span class="operator">,</span> SIGNAL(stateChanged(<span class="type">int</span>))) {}
 <span class="keyword">protected</span>:
     <span class="type">bool</span> eventTest(<span class="type"><a href="qevent.html">QEvent</a></span> <span class="operator">*</span>e) {
         <span class="keyword">if</span> (<span class="operator">!</span><span class="type">QSignalTransition</span><span class="operator">.</span>eventTest(e))
             <span class="keyword">return</span> <span class="keyword">false</span>;
         <span class="type"><a href="qstatemachine.html">QStateMachine</a></span><span class="operator">.</span>SignalEvent <span class="operator">*</span>se <span class="operator">=</span> <span class="keyword">static_cast</span><span class="operator">&lt;</span><span class="type"><a href="qstatemachine.html">QStateMachine</a></span><span class="operator">.</span>SignalEvent<span class="operator">*</span><span class="operator">&gt;</span>(e);
         <span class="keyword">return</span> (se<span class="operator">-</span><span class="operator">&gt;</span>arguments()<span class="operator">.</span>at(<span class="number">0</span>)<span class="operator">.</span>toInt() <span class="operator">=</span><span class="operator">=</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>Checked);
     }
 };

 <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>

 <span class="type"><a href="qcheckbox.html">QCheckBox</a></span> <span class="operator">*</span>check <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcheckbox.html">QCheckBox</a></span>();
 check<span class="operator">-</span><span class="operator">&gt;</span>setTristate(<span class="keyword">true</span>);

 <span class="type"><a href="qstate.html">QState</a></span> <span class="operator">*</span>s1 <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qstate.html">QState</a></span>();
 <span class="type"><a href="qstate.html">QState</a></span> <span class="operator">*</span>s2 <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qstate.html">QState</a></span>();
 CheckedTransition <span class="operator">*</span>t1 <span class="operator">=</span> <span class="keyword">new</span> CheckedTransition(check);
 t1<span class="operator">-</span><span class="operator">&gt;</span><a href="qabstracttransition.html#targetState-prop">setTargetState</a>(s2);
 s1<span class="operator">-</span><span class="operator">&gt;</span>addTransition(t1);
</pre><hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QSignalTransition" />QSignalTransition.__init__ (<i>self</i>, <a href="qstate.html">QState</a>&#160;<i>sourceState</i>&#160;=&#160;None)</h3><p>Constructs a new signal transition with the given
<i>sourceState</i>.</p>


<h3 class="fn"><a name="QSignalTransition-2" />QSignalTransition.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>sender</i>, SIGNAL()&#160;<i>signal</i>, <a href="qstate.html">QState</a>&#160;<i>sourceState</i>&#160;=&#160;None)</h3><p>Constructs a new signal transition associated with the given
<i>signal</i> of the given <i>sender</i>, and with the given
<i>sourceState</i>.</p>


<h3 class="fn"><a name="QSignalTransition-3" />QSignalTransition.__init__ (<i>self</i>, signal&#160;<i>signal</i>, <a href="qstate.html">QState</a>&#160;<i>sourceState</i>&#160;=&#160;None)</h3><h3 class="fn"><a name="event" />bool QSignalTransition.event (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>


<h3 class="fn"><a name="eventTest" />bool QSignalTransition.eventTest (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>event</i>)</h3><p>Reimplemented from <a href="qabstracttransition.html#eventTest">QAbstractTransition.eventTest</a>().</p>
<p>The default implementation returns true if the <i>event</i> is a
<a href="qstatemachine-signalevent.html">QStateMachine.SignalEvent</a>
object and the event's sender and signal index match this
transition, and returns false otherwise.</p>


<h3 class="fn"><a name="onTransition" />QSignalTransition.onTransition (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>event</i>)</h3><p>Reimplemented from <a href="qabstracttransition.html#onTransition">QAbstractTransition.onTransition</a>().</p>
<h3 class="fn"><a name="senderObject" /><a href="qobject.html">QObject</a> QSignalTransition.senderObject (<i>self</i>)</h3><h3 class="fn"><a name="setSenderObject" />QSignalTransition.setSenderObject (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>sender</i>)</h3><h3 class="fn"><a name="setSignal" />QSignalTransition.setSignal (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<i>signal</i>)</h3><h3 class="fn"><a name="signal" /><a href="qbytearray.html">QByteArray</a> QSignalTransition.signal (<i>self</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>